/*===========设置cookie过期时间============*/
function setCookie(name,value,day){
	var date = new Date();
	date.setDate(date.getDate()+day);
	document.cookie = name+'='+escape(value)+';expires='+date;
}
/*===========读取cookie============*/
function getCookie(name){
	var str=document.cookie;
	var arr=str.split('; ');
	for(var i=0;i<arr.length;i++){
		var newArr = arr[i].split('=');
		if(newArr[0] == name){
			return unescape(newArr[1]);
		}
	}
	return '';
}
/*===========删除cookie============*/
function delCookie(name){
	if(getCookie(name) == ""){
		alert("没有找到该用户！")
	}else{
		var date = new Date();
		date.setDate(date.getDate()-1);
		document.cookie=encodeURIComponent(name)+"="+1+";expires="+date;
	}
}

function removeCookie(name){
	setCookie(name,'1','-1');
}
